<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:f="http://java.sun.com/jsf/core"  
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"> 

    <ui:composition template="../index.xhtml">
        <ui:define name="conteudo">
            <h:form id="tituloPagina">
                <h:outputText value="Cadastro de empresas"/>
            </h:form>
            
            <ui:include src="add.xhtml"/>

            <h:form id="formTabela">
                <p:growl id="msg"/>
                <p:dataTable id="listContasPagar" var="forn" value="#{empresaControler.listEmpresa}" widgetVar="carsTableAtivos" 
                             rowKey="#{forn.id}" selectionMode="single"  emptyMessage="Nenhum registro foi encontrado!" paginator="true" rows="10" rowsPerPageTemplate="5,10,15">
                    <f:facet name="header" >  
                        <p:outputPanel>  
                            <h:outputText value="Digite para pesquisar " />
                            <p:inputText id="globalFilter" onkeyup="carsTableAtivos.filter()" style="width:150px" /> 
                            <p:commandButton value="Novo" accesskey="N" onclick="dlgEmpresa.show()" action="#{empresaControler.inicializaObj()}" update=":formAdd"/>
                        </p:outputPanel>  
                    </f:facet>  
                    <p:column headerText="Ações" footerText="Ações" filterMatchMode="Ações" style="width: 60px;">  
                        <p:commandButton action="#{empresaControler.setEmpresa(forn)}" onclick="dlgEmpresa.show();" update=":formAdd"
                                         image="ui-icon ui-icon-pencil" title="alterar" />
                        <p:commandButton image="ui-icon ui-icon-close" title="excluir" 
                                         actionListener="#{empresaControler.setEmpresa(forn)}" onclick="confirmationExcluirgrupo.show();"/>
                    </p:column>
                    <p:column filterBy="${forn.razaoSocial}" headerText="Razão Social" footerText="Razão Social" sortBy="${forn.razaoSocial}">    
                        <h:outputText value="${forn.razaoSocial}" />  
                    </p:column>  
                    <p:column filterBy="${forn.nomeFantasia}" headerText="Fantasia" footerText="Fantasia" sortBy="${forn.nomeFantasia}">    
                        <h:outputText value="${forn.nomeFantasia}" />  
                    </p:column>  
                    <p:column filterBy="${forn.cnpj}" headerText="CNPJ" footerText="CNPJ" sortBy="${forn.cnpj}">    
                        <h:outputText value="${forn.cnpj}" />  
                    </p:column>  
                    <p:column filterBy="${forn.inscricaoEstadual}" headerText="Insc. Estadual" footerText="Insc. Estadual" sortBy="${forn.inscricaoEstadual}">    
                        <h:outputText value="${forn.inscricaoEstadual}" />  
                    </p:column>  

                </p:dataTable>
            </h:form>

        </ui:define>
    </ui:composition>
</html>